﻿using AutoMapper;
using Domain.Entity;
using Domain.Entity.Fy;
using Domain.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.EIService
{
	public class EIService : IEIService
	{
		private readonly IEIRepository eIRepository;
		private readonly IMapper mapper;

		public EIService(IEIRepository eIRepository, IMapper mapper)
		{
			this.eIRepository = eIRepository;
			this.mapper = mapper;
		}
		public Task<bool> AddEI(EIDto e)
		{
			EI eI = mapper.Map<EI>(e);
			return eIRepository.AddEI(eI);
		}

		public Task<bool> DeleteEI(int id)
		{
			return eIRepository.DeleteEI(id);
		}

		public List<IAM> GetAllEI()
		{
			return eIRepository.GetAllEI();
		}

		public List<EI> GetEI()
		{
			return eIRepository.GetEI();
		}

		public IAMFy GetEIFY(int currentPage, int pageSize, string checkStatus)
		{
			return eIRepository.GetEIFY(currentPage, pageSize, checkStatus);
		}

		public IAMFy GetEIFYPassPassComment(int currentPage, int pageSize, string PassPassComment)
		{
			return eIRepository.GetEIFYPassPassComment(currentPage, pageSize, PassPassComment);
		}

		public IAMFy GetEIFYTongyi(int currentPage, int pageSize, string PassPassComment)
		{
			return eIRepository.GetEIFYTongyi(currentPage, pageSize, PassPassComment);
		}

		public List<IAM> GetIAMs()
		{
			return eIRepository.GetIAMs();
		}

		public Task<bool> UpdateEI(EIDto e)
		{
			EI eI = mapper.Map<EI>(e);
			return eIRepository.UpdateEI(eI);
		}

		public Task<bool> UpdateEICheckStatus(EIDto e)
		{
			EI eI = mapper.Map<EI>(e);
			return eIRepository.UpdateEICheckStatus(eI);
		}
	}
}
